from ckeditor_uploader.fields import RichTextUploadingField
from django.db import models


# Create your models here.
class ActivityCourse(models.Model):
    title = models.CharField(max_length=100, verbose_name='标题')
    abstract = models.TextField(max_length=200, verbose_name='摘要')
    content = RichTextUploadingField(config_name='my_config', verbose_name='内容')
    update_time = models.DateTimeField(auto_now=True, verbose_name='修改日期')
    create_time = models.DateTimeField(auto_now_add=True, verbose_name='发布日期')
    img = models.ImageField(upload_to='upload/activity', max_length=100, null=True, blank=True)

    def __str__(self):
        return self.title

    class Meta:
        verbose_name = '课程培训'
        verbose_name_plural = '课程培训'


class ActivityProjectDevelop(models.Model):
    title = models.CharField(max_length=100, verbose_name='标题')
    abstract = models.TextField(max_length=200, verbose_name='摘要')
    content = RichTextUploadingField(config_name='my_config', verbose_name='内容')
    update_time = models.DateTimeField(auto_now=True, verbose_name='修改日期')
    create_time = models.DateTimeField(auto_now_add=True,verbose_name='发布日期')
    img = models.ImageField(upload_to='upload/activity', max_length=100, null=True, blank=True)

    def __str__(self):
        return self.title

    class Meta:
        verbose_name = '项目开发'
        verbose_name_plural = '项目开发'


class ActivityContest(models.Model):
    title = models.CharField(max_length=100, verbose_name='标题')
    abstract = models.TextField(max_length=200, verbose_name='摘要')
    content = RichTextUploadingField(config_name='my_config', verbose_name='内容')
    update_time = models.DateTimeField(auto_now=True, verbose_name='修改日期')
    create_time = models.DateTimeField(auto_now_add=True,verbose_name='发布日期')
    img = models.ImageField(upload_to='upload/activity', max_length=100, null=True, blank=True)

    def __str__(self):
        return self.title

    class Meta:
        verbose_name = '编程比赛'
        verbose_name_plural = '编程比赛'
